//$Id: Piece.java 186 2010-11-07 06:00:54Z liangyj20030161@yahoo.com.sg $
package builders;

/**
 * This Piece object is attached to a Player object.
 * @author Liang Yujing
 *
 */
public class Piece {
	private String imagefile;
	private static String piece1 = "piece1.png";
	private static String piece2 = "piece2.png";
	private static String piece3 = "piece3.png";
	private static String piece4 = "piece4.png";	
	private int position;

	/**
	 * Constructor for Piece; image files for Pieces are matched according to the homebase of the Player that holds the Piece
	 */
	public Piece(int homeBase){
		homeBaseToImageFile(homeBase);
	}

	/**
	 * Returns image file of Piece
	 * @return String imagefile
	 */
	public String getPieceFileName(){
		return imagefile;
	}

	public int getPosition(){
		return position;
	}

	public void setPosition(int position){
		this.position = position;
	}

	/**
	 * Sets the image file to the Piece depending on the homebase of the Player that holds the Piece
	 * @param int homeBase
	 */
	private void homeBaseToImageFile(int homeBase){
		switch (homeBase) {
		case 0:
			imagefile = piece1;
			break;
		case 9:
			imagefile = piece2;
			break;
		case 18:
			imagefile = piece3;
			break;
		case 27:
			imagefile = piece4;
			break;
		}
	}
}
